package simplescenegraph;

import java.util.ArrayList;
import java.util.List;

public abstract class AbstractRenderer implements Renderer {
	
	protected List<RenderingCallback> callbacks = new ArrayList<RenderingCallback>();
	
	@Override
	public void addCallback(RenderingCallback arg0) {
		callbacks.add(arg0);
	}
	
	@Override
	public void removeCallback(RenderingCallback arg0) {
		callbacks.remove(arg0);
	}
	
	protected void invokeBeforeSceneRenderingCallbacks() {
		for (RenderingCallback callback : callbacks) {
			callback.beforeSceneRendering(this);
		}
	}
	
	protected void invokeAfterSceneRenderingCallbacks() {
		for (RenderingCallback callback : callbacks) {
			callback.afterSceneRendering(this);
		}
	}
	
}
